package Test

import (
	"baikBingo/pkg/Util"
	"baikBingo/pkg/Wechat"

	"github.com/gin-gonic/gin"
)

type IndexJob struct {
	jsCode string
}

func (vm *IndexJob) construct(request *gin.Context) {
	vm.jsCode = request.DefaultQuery("jsCode", "")
}

func (vm *IndexJob) Handle(request *gin.Context) gin.H {

	//此项必须含有，赋值操作
	vm.construct(request)

	res := Wechat.Jscode2session(vm.jsCode)

	return gin.H{
		"code": Util.Config("response.success.code"),
		"msg":  Util.Config("response.success.msg"),
		"data": res,
	}
}
